<?php

include_once('logic/view/View.php');

class CommentView extends View
{
    private	$_photos;

    // admin
    function __construct()
    {
	parent::__construct("ADMINISTRATOR");
	$this->_xsl_template = 'template/comment_template.xsl';

	// create the photos element
	$this->_comments = $this->_root->appendChild($this->_xml_doc->createElement('comments'));

	// <comments>
	// ...
	// </comments>
    }

    function addTableEntry($photoId, $name, $commenttext, $email, $url)
    {
	// <comment>
	//   <id>$photoId</id>
	//   <name>$name</name>
	//   <comment>$comment</comment>
	//   <email>$email</email>
	//	 <url>$url</url>
	// </comment>

	$comment = $this->_xml_doc->createElement('comment');
        $this->_comments->appendChild($comment);

	$id_node = $comment->appendChild($this->_xml_doc->createElement('photoId'));
	$id_node->appendChild($this->_xml_doc->createTextNode($photoId));

	$name_node = $comment->appendChild($this->_xml_doc->createElement('name'));
	$name_node->appendChild($this->_xml_doc->createTextNode($name));

	$commenttext_node = $comment->appendChild($this->_xml_doc->createElement('commenttext'));
	$commenttext_node->appendChild($this->_xml_doc->createTextNode($commenttext));

	$email_node = $comment->appendChild($this->_xml_doc->createElement('email'));
	$email_node->appendChild($this->_xml_doc->createTextNode($email));

	$url_node = $comment->appendChild($this->_xml_doc->createElement('url'));
	$url_node->appendChild($this->_xml_doc->createTextNode($url));
    }
}

?>
